import 'package:flutter_demo/pages/common/common_appbar.dart';
import 'package:flutter_demo/utils/dialog_utils.dart';
import 'package:flutter_demo/widgets/list_title_widgets.dart';
import 'package:flutter/material.dart';

/// @author longzipeng
/// @创建时间：2022/3/31
/// 弹框演示页面

class DialogUtilsDemoPage extends StatefulWidget {
  const DialogUtilsDemoPage({Key? key}) : super(key: key);

  @override
  State<DialogUtilsDemoPage> createState() => _DialogUtilsDemoPageState();
}

class _DialogUtilsDemoPageState extends State<DialogUtilsDemoPage> {
  /// 查询数据
  search(value) {
    print("搜索的值为：$value");
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: const CommonAppbar(
        title: "弹窗、提示演示",
      ),
      body: ListView(
        children: [
          ListTitleWidget(
            title: const Text("弹框，带确认和取消"),
            onTap: () {
              DialogUtils.alert(context, content: "靓仔、靓女们，一起学习flutter！",
                  confirm: () {
                print("点击了确认");
              }, cancle: () {
                print("点击了取消");
              });
            },
          ),
          ListTitleWidget(
            title: const Text("默认提示"),
            onTap: () {
              DialogUtils.showMessage("默认提示");
            },
          ),
          ListTitleWidget(
            title: const Text("成功提示"),
            onTap: () {
              DialogUtils.showSuccessMessage("成功提示");
            },
          ),
          ListTitleWidget(
            title: const Text("警告提示"),
            onTap: () {
              DialogUtils.showWaringMessage("警告提示");
            },
          ),
          ListTitleWidget(
            title: const Text("错误提示"),
            onTap: () {
              DialogUtils.showErrorMessage("错误提示");
            },
          ),
        ],
      ),
    );
  }
}
